/*
 * @Author: nengwu 409791297@qq.com
 * @Date: 2020-06-28 17:08:02
 * @LastEditors: mylesshie@gmail.com
 * @LastEditTime: 2020-07-10 18:23:38
 * @description: 
 */ 
import React from 'react'
import {
  View,
  ImageBackground,
  Text,
  TouchableOpacity
} from 'react-native'
import { useNavigation } from '@react-navigation/native'
import styles from './styles'
import LiveIcon from '../LiveIcon'

const LiveItem = props => {
  const navigation = useNavigation()
  const _goDetail = () => {

    navigation.navigate('Webview', {
      url: props.videoUrl,
      title: props.videoTitle
    })
  }

  return (
    <TouchableOpacity onPress={_goDetail}>
      <View style={styles.wrap}>
        <ImageBackground source={{
          uri: props.coverUrl
        }} style={styles.background}>
          <LiveIcon />
          <View style={styles.infoBox}>
            <Text style={styles.title} ellipsizeMode="tail" numberOfLines={1}>{props.videoTitle}</Text>
            <Text style={styles.tips}>{props.viewCount}人观看 {props.createdTime}</Text>
          </View>
        </ImageBackground>
      </View>
    </TouchableOpacity>
  )
}

export default LiveItem